#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 110, M = 6010, mod = 1e4 + 7;

char offset = 'A';
int tr[M][26], fail[M], ed[M], idx;
int f[N][M];
//串长为i且在ac自动机上走到编号为j的节点的3合法串的个数
//如果走到 j 的儿子 k 这个节点的串合法，那么就可以从 (i,j) 转移到 (i+1,ch[j][k])

void insert(const string& s)
{
    int p = 0;
    for (char it : s) {
        int c = it - offset;
        if (tr[p][c] == 0) tr[p][c] = ++idx;
        p = tr[p][c];
    }
    ed[p] = 1;
}

void setfail()
{
    queue<int> q;
    for (int i = 0;i < 26;i++) if (tr[0][i]) { q.push(tr[0][i]); }
    while (!q.empty()) {
        int now = q.front();q.pop();
        for (int i = 0;i < 26;i++) {
            if (tr[now][i]) {
                fail[tr[now][i]] = tr[fail[now]][i];
                ed[tr[now][i]] |= ed[fail[tr[now][i]]];
                q.push(tr[now][i]);
            } else tr[now][i] = tr[fail[now]][i];
        }
    }
}

int ksm(int a, int b)
{
    int res = 1;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;b >>= 1;
    }
    return res;
}

void solve()
{
    int n, m; string s;
    cin >> n >> m;
    for (int i = 1;i <= n;i++) {
        cin >> s;
        insert(s);
    }
    setfail();

    f[0][0] = 1;
    for (int i = 0;i < m;i++)
        for (int j = 0;j <= idx;j++)
            for (int k = 0;k < 26;k++)
                if (ed[tr[j][k]] == 0)
                    (f[i + 1][tr[j][k]] += f[i][j]) %= mod;

    int sum = 0;
    for (int i = 0;i <= idx;i++) (sum += f[m][i]) %= mod;
    cout << (ksm(26, m) - sum + mod) % mod;
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}